package com.cloudbroker.bcs.platform.dav.bizapi.constants.status;

public enum TaskStatus {
    
    /**
     * 等待处理
     */
    UNHANDLED(1, "待处理"),
    
    /**
     * 处理中
     */
    HANDLING(2, "处理中"),
    
    /**
     * 已处理
     */
    HANDLED(3, "已处理");
    
    private final int val;
    
    private final String description;
    
    private String toString;
    
    private TaskStatus(int val, String description) {
        this.val = val;
        this.description = description;
    }
    
    public int getVal() {
        return val;
    }
    
    public String getDescription() {
        return description;
    }
    
    public static String getDescription(int val) {
        for (TaskStatus taskStatus : TaskStatus.values()) {
            if (taskStatus.getVal() == val) {
                return taskStatus.getDescription();
            }
        }
        return String.valueOf(val);
    }
    
    @Override
    public String toString() {
        if (null == toString) {
            toString = new StringBuilder().append("TaskStatus[").append(val).append(':').append(description)
                    .append(']').toString();
        }
        return toString;
    }
    
}
